<?php

/* * 
 * 活动推荐
 */
namespace Api\Model;
use Think\Model;
class ActivityRecommendModel extends Model {

    //映射
    protected $_map = array(

    );

    //获取活动推荐列表
    public function getActivityRecommendList($pageNum) {

        $list = $this->alias('ar')
            ->join("LEFT JOIN __ACTIVITY__ a ON ar.activity_id = a.activity_id")
            ->field("a.activity_id, a.activity_name, a.activity_image_url, a.time_string, a.address,
            a.latitude, a.longitude, a.join_count, a.collect_count")
            ->order("ar.create_time ASC")
            ->limit(($pageNum-1)*C('DEFAULT_PAGE_SIZE') . ',' . C('DEFAULT_PAGE_SIZE'))
            ->select();

        //获取每个活动的多个分类
        foreach ($list as &$item) {
            $item['category_list'] = D('categoryRelationship')->getCategoryList($item['activity_id'],C("CATEGORY_RELATIONSHIP_TYPE.ACTIVITY"));
        }

        return $list;
    }

}

